package com.bawei.rk_01.fm

import android.app.Activity
import android.content.Intent
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.bawei.base.utils.mvvm.BaseViewFragment
import com.bawei.rk_01.Adapter.GlideUtils
import com.bawei.rk_01.R
import com.bawei.rk_01.databinding.FragmentMineBinding
import com.wildma.pictureselector.PictureBean
import com.wildma.pictureselector.PictureSelector


class MineFragment : BaseViewFragment<FragmentMineBinding>() {
    override fun getLayout(): Int {
        return R.layout.fragment_mine
    }

    override fun initView() {

        binding.touxiang.setOnClickListener {
            PictureSelector.create(this,101).selectPicture()
        }

    }

    override fun initData() {

    }

    override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
        super.onActivityResult(requestCode, resultCode, data)
        if (requestCode == 101 && resultCode == Activity.RESULT_OK){
            val bean = data?.extras?.get(PictureSelector.PICTURE_RESULT) as PictureBean
            context?.let { GlideUtils.loadImage(it,bean.path,binding.touxiang) }
        }
    }

}